import request from './request'
/**
 * 获取频道列表
 */
export const channels = () =>
  request({
    url: '/v1_0/channels',
    method: 'GET',
  })

// 获取文章列表
export const articles = (params) =>
  request({
    url: '/v1_0/mp/articles',
    method: 'GET',
    params,
  })

// 删除文章
export const deleteArticle = (target) =>
  request({
    url: `/v1_0/mp/articles/${target}`,
    method: 'DELETE',
  })

// 发表文章
export const subArticle = (draft, data) =>
  request({
    url: `/v1_0/mp/articles?draft=${draft}`,
    method: 'POST',
    data,
  })

// 获取文章详情
export const articleDetails = (id) =>
  request({
    url: `/v1_0/mp/articles/${id}`,
  })

// 編輯文章
export const 編輯文章 = (id, target, data) =>
  request({
    url: `/v1_0/mp/articles/${id}?draft=${target}`,
    method: 'PUT',
    data,
  })
